package com.qys.livesMall.app.user.controller.app;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qys.livesMall.app.user.model.dto.app.AppUserInfoTeamIncomeDTO;
import com.qys.livesMall.app.user.model.vo.app.AppUserInfoTeamDetailVo;
import com.qys.livesMall.app.user.model.vo.app.AppUserInfoTeamVo;
import com.qys.livesMall.app.user.service.UserStatisticsTeamService;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.finance.model.vo.AppUserInfoTeamIncomeVO;
import com.qys.livesMall.framework.utils.SecurityUtils;
import com.qys.livesMall.framework.view.BaseQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 团队统计数据 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-08-02
 */
@RestController
@RequestMapping("/app/userStatisticsTeam")
@Tag(name = "用户团队信息", description = "用户团队信息")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppUserStatisticsTeamController {

    private final UserStatisticsTeamService userStatisticsTeamService;

    @GetMapping("/getUserTeam")
    @Operation(summary = "用户团队信息")
    public R<AppUserInfoTeamVo> getUserTeam(){
        return R.ok(userStatisticsTeamService.getUserTeam(SecurityUtils.getUserId()));
    }

    @PostMapping("/page/getUserlist")
    @Operation(summary = "查询用户团列表")
    public R<Page<AppUserInfoTeamDetailVo>> getUserlist(@RequestBody BaseQuery baseQuery) {
        return R.ok(userStatisticsTeamService.getUserlist(baseQuery));
    }

    @PostMapping("/getUserlistIncome")
    @Operation(summary = "查询用户团收益列表")
    public R<Page<AppUserInfoTeamIncomeVO>> getUserlistIncome(@RequestBody AppUserInfoTeamIncomeDTO incomeDTO) {
        return R.ok(userStatisticsTeamService.getUserlistIncome(incomeDTO));
    }
}
